/**
 * Copyright (c) 2018-2028.
 * <p>
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.gnu.org/licenses/lgpl.html
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.sailmi.common.model.auth;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;

/**
 * 用户实体
 *
 *
 */

public class AuthUser implements Serializable {

	private static final long serialVersionUID = 1L;
	/**
	 * 客户端id
	 */
	private String clientId;

	/**
	 * 用户id
	 */
	private Long userId;

	/**
	 * 用户编号
	 */
	private String userCode;
	/**
	 * 租户ID
	 */
	private String tenantId;
	/**
	 * 当前用户操作企业ID
	 */
	private String enterprise;
	/**
	 * 用户真实姓名
	 */
	private String userName;
	/**
	 * 账号
	 */
	private String account;
	/**
	 * 密码
	 */
	private String password;

	private String roleIdString;
	/**
	 * 昵称
	 */
	private String nickName;
	/**
	 * 当前业务角色列表,更细的角色清单
	 */
	private List<String> roles;
	/**
	 * 当前业务角色授权表
	 */
	private List<String> permissions;

	/**
	 * 用户有效期限
	 */
	private long expiresIn;
	/**
	 * 手机号
	 */
	private String phone;
	/**
	 * 用户头像
	 */
	private String avatar;

	private String mail;
	/**
	 * 角色名
	 */
	private String roleName;
	/**
	 * 是否初始化密码
	 */
	private boolean isInitpass;
	//其它自定义属性放在这个里面
	private HashMap<String,String> userInfoMap=new HashMap<>();

	public HashMap<String, String> getUserInfoMap() {
		return userInfoMap;
	}

	public void setUserInfoMap(HashMap<String, String> userInfoMap) {
		this.userInfoMap = userInfoMap;
	}

	public String getAvatar() {
		return avatar;
	}

	public void setAvatar(String avatar) {
		this.avatar = avatar;
	}

	public String getClientId() {
		return clientId;
	}

	public void setClientId(String clientId) {
		this.clientId = clientId;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getUserCode() {
		return userCode;
	}

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}

	public String getTenantId() {
		return tenantId;
	}

	public void setTenantId(String tenantId) {
		this.tenantId = tenantId;
	}

	public String getEnterprise() {
		return enterprise;
	}

	public void setEnterprise(String enterpriseId) {
		this.enterprise = enterprise;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public List<String> getRoles() {
		return roles;
	}

	public void setRoles(List<String> roles) {
		this.roles = roles;
		String roleIds = "";
		if(Objects.nonNull(roles)&&roles.size()>0){
			for (String a:roles) {
				roleIds=roleIds.concat(a);
			}
		}
		roleIdString = roleIds;
	}

	public List<String> getPermissions() {
		return permissions;
	}

	public void setPermissions(List<String> permissions) {
		this.permissions = permissions;
	}

	public long getExpiresIn() {
		return expiresIn;
	}

	public void setExpiresIn(long expiresIn) {
		this.expiresIn = expiresIn;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public boolean isInitpass() {
		return isInitpass;
	}

	public void setInitpass(boolean initpass) {
		isInitpass = initpass;
	}

	public String getRoleIdString(){
		return roleIdString;
	}

	public void setRoleIdString(String roleIdString) {
		this.roleIdString = roleIdString;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}
}
